// exec uted in the renderer process for that window.
// All of the Node.js APIs are available in this proces

const {remote} = require('electron');
const {Menu, BrowserWindow, MenuItem, shell} = remote;

var abar = require('address_bar');
var folder_view = require('folder_view');
var $ = global.jQuery = require('./node_modules/jquery/dist/jquery.min.js');

$(function() {
    // alert("loaded!" + process.platform);
    document.write('<p>myvar: ' + remote.getGlobal('sharedObj').myvar + '</p>');
});

// self-define object
var electron_test = (function () {
    var test_file_obj = function () {
        // =====================================
        // test [html5 file object]
        // =====================================
        document.getElementById('holder').addEventListener('drop', (e) => {
            e.preventDefault();
            e.stopPropagation();

            for (const f of e.dataTransfer.files) {
                console.log('File(s) you dragged here: ', f.path)
            }
        });
        document.getElementById('holder').addEventListener('dragover', (e) => {
            e.preventDefault();
            e.stopPropagation();
        });
    };

    var test_open_a_browser_win = function() {
        window.open('https://cn.bing.com/', '_blank', 'nodeIntegration=no');
    };

    return {
        test_file_obj: test_file_obj,
        test_open_a_browser_win: test_open_a_browser_win,
    };
})();

electron_test.test_file_obj();